home *** CD-ROM | disk | FTP | other *** search
/ Mastering Web Site Development / Microsoft Mastering Web Site Development (Microsoft) (1997).iso / Labs / StateUFinal / classForm.asp < prev    next >
Text File  |  1997-04-24  |  24KB  |  649 lines

  1. <%@ LANGUAGE="vbscript" %>
  2. <%
  3. '-------------------------------------------------------------------------------
  4. ' Microsoft Visual InterDev - Data Form Wizard
  5. ' Form Page
  6. '
  7. ' (c) 1997 Microsoft Corporation.  All Rights Reserved.
  8. '
  9. ' This file is an Active Server Page that contains the form view of a Data Form. 
  10. ' It requires Microsoft Internet Information Server 3.0 and can be displayed
  11. ' using any browser that supports tables. You can edit this file to further 
  12. ' customize the form view.
  13. '
  14. ' Modes:         The form mode can be controlled by passing the following
  15. '                name/value pairs using POST or GET:
  16. '                FormMode=Edit
  17. '                FormMode=Filter
  18. '                FormMode=New
  19. ' Tips:            - If a field contains a URL to an image and has a name that 
  20. '                begins with "img_" (case-insensitive), the image will be 
  21. '                displayed using the IMG tag.
  22. '                - If a field contains a URL and has a name that begins with 
  23. '                "url_" (case-insensitive), a jump will be displayed using the 
  24. '                Anchor tag.
  25. '-------------------------------------------------------------------------------
  26.  
  27. Dim strPagingMove    
  28. Dim strFormMode
  29. Dim strDFName
  30. strDFName = "rsclassClasses"
  31. %>
  32.  
  33. <SCRIPT RUNAT=Server LANGUAGE="VBScript">
  34.  
  35. '---- FieldAttributeEnum Values ----
  36. Const adFldUpdatable = &H00000004
  37. Const adFldUnknownUpdatable = &H00000008
  38. Const adFldIsNullable = &H00000020
  39.  
  40. '---- DataTypeEnum Values ----
  41. Const adUnsignedTinyInt = 17
  42. Const adBoolean = 11
  43. Const adLongVarChar = 201
  44. Const adLongVarWChar = 203
  45. Const adBinary = 128
  46. Const adVarBinary = 204
  47. Const adLongVarBinary = 205
  48. Const adVarChar = 200
  49. Const adWVarChar = 202
  50. Const adBSTR = 8
  51. Const adChar = 129
  52. Const adWChar = 130
  53. '---- Other Values ----
  54. Const dfMaxSize = 100
  55.  
  56. '-------------------------------------------------------------------------------
  57. ' Purpose:  Substitutes Empty for Null and trims leading/trailing spaces
  58. ' Inputs:   varTemp    - the target value
  59. ' Returns:    The processed value
  60. '-------------------------------------------------------------------------------
  61.  
  62. Function ConvertNull(varTemp)
  63.     If IsNull(varTemp) Then
  64.         ConvertNull = ""
  65.     Else
  66.         ConvertNull = Trim(varTemp)
  67.     End If
  68. End Function
  69.  
  70. '-------------------------------------------------------------------------------
  71. ' Purpose:  Embeds bracketing quotes around the string
  72. ' Inputs:   varTemp    - the target value
  73. ' Returns:    The processed value
  74. '-------------------------------------------------------------------------------
  75.  
  76. Function QuotedString(varTemp)
  77.     If IsNull(varTemp) Then
  78.         QuotedString = Chr(34) & Chr(34)
  79.     Else
  80.         QuotedString = Chr(34) & CStr(varTemp) & Chr(34)
  81.     End If
  82. End Function
  83.  
  84. '-------------------------------------------------------------------------------
  85. ' Purpose:  Tests string to see if it is a URL by looking for protocol
  86. ' Inputs:   varTemp    - the target value
  87. ' Returns:    True - if is URL, False if not
  88. '-------------------------------------------------------------------------------
  89.  
  90. Function IsURL(varTemp)
  91.     IsURL = True
  92.     If UCase(Left(Trim(varTemp), 6)) = "HTTP:/" Then Exit Function
  93.     If UCase(Left(Trim(varTemp), 6)) = "FILE:/" Then Exit Function
  94.     If UCase(Left(Trim(varTemp), 8)) = "MAILTO:/" Then Exit Function
  95.     If UCase(Left(Trim(varTemp), 5)) = "FTP:/" Then Exit Function
  96.     If UCase(Left(Trim(varTemp), 8)) = "GOPHER:/" Then Exit Function
  97.     If UCase(Left(Trim(varTemp), 6)) = "NEWS:/" Then Exit Function
  98.     If UCase(Left(Trim(varTemp), 7)) = "HTTPS:/" Then Exit Function
  99.     If UCase(Left(Trim(varTemp), 8)) = "TELNET:/" Then Exit Function
  100.     If UCase(Left(Trim(varTemp), 6)) = "NNTP:/" Then Exit Function
  101.     IsURL = False
  102. End Function
  103.  
  104. '-------------------------------------------------------------------------------
  105. ' Purpose:  Tests whether the field in the recordset is updatable
  106. ' Assumes:     That the recordset containing the field is open
  107. ' Inputs:   strFieldName    - the name of the field in the recordset
  108. ' Returns:    True if updatable, False if not
  109. '-------------------------------------------------------------------------------
  110.  
  111. Function CanUpdateField(strFieldName)
  112.     Dim intUpdatable
  113.     intUpdatable = (adFldUpdatable Or adFldUnknownUpdatable)
  114.     CanUpdateField = True
  115.     If (rsclassClasses(strFieldName).Attributes And intUpdatable) = False Then
  116.         CanUpdateField = False
  117.     End If
  118. End Function
  119.  
  120. '-------------------------------------------------------------------------------
  121. ' Purpose:  Handles the display of a field from a recordset depending
  122. '            on its data type, attributes, and the current mode.
  123. ' Assumes:     That the recordset containing the field is open
  124. '            That strFormMode is initialized
  125. ' Inputs:   strFieldName     - the name of the field in the recordset
  126. '            strLabel        - the label to display
  127. '            blnIdentity        - identity field flag
  128. '            avarLookup        - array of lookup values
  129. '-------------------------------------------------------------------------------
  130.  
  131. Sub ShowField(strFieldName, strLabel, blnIdentity, avarLookup)
  132.     Dim blnFieldRequired
  133.     Dim intMaxSize
  134.     Dim intInputSize
  135.     Dim strOption1State
  136.     Dim strOption2State
  137.     Dim strFieldValue
  138.     Dim nPos
  139.     strFieldValue = ""
  140.     nPos=Instr(strFieldName,".")
  141.     Do While nPos > 0 
  142.         strFieldName= Mid (strFieldName, nPos+1)
  143.         nPos=Instr(strFieldName,".")
  144.     Loop 
  145.     ' If not in Edit form mode then set value to empty so doesn't display
  146.     strFieldValue = ""
  147.     If strFormMode = "Edit" Then strFieldValue = rsclassClasses(strFieldName)
  148.     
  149.     ' See if the field is required by checking the attributes 
  150.     blnFieldRequired = False
  151.     If (rsclassClasses(strFieldName).Attributes And adFldIsNullable) = 0 Then 
  152.         blnFieldRequired = True
  153.     End If
  154.     
  155.     ' Set values for the MaxLength and Size attributes    
  156.     intMaxSize = dfMaxSize
  157.     intInputSize = rsclassClasses(strFieldName).DefinedSize + 2
  158.     If strFormMode <> "Filter" Then intMaxSize = intInputSize - 2
  159.     
  160.     ' Write the field label and start the value cell
  161.     Response.Write "<TR VALIGN=TOP>"
  162.     Response.Write "<TD HEIGHT=25 ALIGN=Left NOWRAP><FONT SIZE=-1><B>  " & strLabel & "</B></FONT></TD>"    
  163.     Response.Write "<TD WIDTH=100% ><FONT SIZE=-1>"
  164.     
  165.     ' If the field is not updatable, then handle 
  166.     ' it like an Identity column and exit
  167.     If Not CanUpdateField(strFieldName) Then
  168.         ' Special handling if Binary
  169.         Select Case rsclassClasses(strFieldName).Type
  170.             Case adBinary, adVarBinary, adLongVarBinary        'Binary
  171.                 Response.Write "[Binary]"
  172.             Case Else        
  173.                 Select Case strFormMode
  174.                     Case "Edit"
  175.                         Response.Write ConvertNull(strFieldValue)
  176.                         Response.Write "<INPUT TYPE=Hidden NAME=" & QuotedString(strFieldName)
  177.                         Response.Write " VALUE=" & QuotedString(strFieldValue) & " >"
  178.                     Case "New"
  179.                         Response.Write "[AutoNumber]"
  180.                         Response.Write "<INPUT TYPE=Hidden NAME=" & QuotedString(strFieldName)
  181.                         Response.Write " VALUE=" & QuotedString(strFieldValue) & " >"
  182.                     Case "Filter" 
  183.                         Response.Write "<INPUT TYPE=Text NAME=" & QuotedString(strFieldName)
  184.                         Response.Write " SIZE=" & intInputSize
  185.                         Response.Write " MAXLENGTH=" & intMaxSize
  186.                         Response.Write " VALUE=" & QuotedString(strFieldValue) & " >"
  187.                 End Select
  188.         End Select
  189.         Response.Write "</FONT></TD></TR>"
  190.         Exit Sub
  191.     End If
  192.     
  193.     ' Handle lookups using a select and options
  194.     If Not IsNull(avarLookup) Then
  195.         Response.Write "<SELECT NAME=" & QuotedString(strFieldName) & ">"
  196.         ' Add blank entry if not required or in filter mode
  197.         If Not blnFieldRequired Or strFormMode = "Filter" Then
  198.             If (strFormMode = "Filter" Or strFormMode = "New") Then
  199.                 Response.Write "<OPTION SELECTED>"
  200.             Else
  201.                 Response.Write "<OPTION>"
  202.             End If
  203.         End If
  204.         
  205.         ' Loop thru the rows in the array
  206.         For intRow = 0 to UBound(avarLookup, 2)
  207.             Response.Write "<OPTION VALUE=" & QuotedString(avarLookup(0, intRow))
  208.             If strFormMode = "Edit" Then
  209.                 If ConvertNull(avarLookup(0, intRow)) = ConvertNull(strFieldValue) Then
  210.                        Response.Write " SELECTED"
  211.                 End If
  212.             End If
  213.                Response.Write ">"
  214.             Response.Write ConvertNull(avarLookup(1, intRow))
  215.         Next
  216.         Response.Write "</SELECT>"
  217.         If blnFieldRequired And strFormMode = "New" Then 
  218.             Response.Write "  Required"
  219.         End If
  220.         Response.Write "</FONT></TD></TR>"
  221.         Exit Sub
  222.     End If    
  223.     
  224.     ' Evaluate data type and handle appropriately
  225.     Select Case rsclassClasses(strFieldName).Type
  226.     
  227.         Case adBoolean, adUnsignedTinyInt                'Boolean
  228.             If strFormMode = "Filter" Then                
  229.                 strOption1State = " >True"
  230.                 strOption2State = " >False"
  231.             Else
  232.                 Select Case strFieldValue
  233.                     Case "True", "1", "-1"
  234.                         strOption1State = " CHECKED>True"
  235.                         strOption2State = " >False"
  236.                     Case "False", "0"
  237.                         strOption1State = " >True"
  238.                         strOption2State = " CHECKED>False"
  239.                     Case Else
  240.                         strOption1State = " >True"
  241.                         strOption2State = " >False"
  242.                 End Select
  243.             End If            
  244.             Response.Write "<INPUT TYPE=Radio VALUE=1 NAME=" & QuotedString(strFieldName) & strOption1State
  245.             Response.Write "<INPUT TYPE=Radio VALUE=0 NAME=" & QuotedString(strFieldName) & strOption2State
  246.             If strFormMode = "Filter" Then
  247.                 Response.Write "<INPUT TYPE=Radio NAME=" & QuotedString(strFieldName) & " CHECKED>Neither"
  248.             End If
  249.             
  250.         Case adBinary, adVarBinary, adLongVarBinary        'Binary
  251.             Response.Write "[Binary]"
  252.             
  253.         Case adLongVarChar, adLongVarWChar                'Memo
  254.             Response.Write "<TEXTAREA NAME=" & QuotedString(strFieldName) & " ROWS=3 COLS=80>"
  255.             Response.Write ConvertNull(strFieldValue)
  256.             Response.Write "</TEXTAREA>"
  257.             
  258.         Case Else
  259.             Dim nType 
  260.             nType=rsclassClasses(strFieldName).Type
  261.             If (nType <> adVarChar) and (nType <> adWVarChar) and (nType <> adBSTR) and (nType <> adChar) and (nType <> adWChar)  Then
  262.                 intInputSize = (intInputSize-2)*3+2
  263.                 If strFormMode <> "Filter" Then intMaxSize = intInputSize - 2
  264.             End If
  265.             If blnIdentity Then
  266.                 Select Case strFormMode
  267.                     Case "Edit"
  268.                         Response.Write ConvertNull(strFieldValue)
  269.                         Response.Write "<INPUT TYPE=Hidden NAME=" & QuotedString(strFieldName)
  270.                         Response.Write " VALUE=" & QuotedString(strFieldValue) & " >"
  271.                     Case "New"
  272.                         Response.Write "[AutoNumber]"
  273.                         Response.Write "<INPUT TYPE=Hidden NAME=" & QuotedString(strFieldName)
  274.                         Response.Write " VALUE=" & QuotedString(strFieldValue) & " >"
  275.                     Case "Filter" 
  276.                         Response.Write "<INPUT TYPE=Text NAME=" & QuotedString(strFieldName) & " SIZE=" & tInputSize
  277.                         Response.Write " MAXLENGTH=" & tMaxSize & " VALUE=" & QuotedString(strFieldValue) & " >"
  278.                 End Select
  279.             Else
  280.                 If intInputSize > 80 Then intInputSize = 80            
  281.                 Response.Write "<INPUT TYPE=Text NAME=" & QuotedString(strFieldName)
  282.                 Response.Write " SIZE=" & intInputSize
  283.                 Response.Write " MAXLENGTH=" & intMaxSize
  284.                 Response.Write " VALUE=" & QuotedString(strFieldValue) & " >"
  285.                 ' Check for special field types
  286.                 Select Case UCase(Left(rsclassClasses(strFieldName).Name, 4))
  287.                     Case "IMG_"
  288.                         If strFieldValue <> "" Then
  289.                             Response.Write "<BR><BR><IMG SRC=" & QuotedString(strFieldValue) & "><BR> <BR>"
  290.                         End If
  291.                     Case "URL_"
  292.                         If strFieldValue <> "" Then
  293.                             Response.Write "  <A HREF=" & QuotedString(strFieldValue) & ">"
  294.                             Response.Write "Go"
  295.                             Response.Write "</A>"
  296.                         End If
  297.                     Case Else
  298.                         If IsURL(strFieldValue) Then
  299.                             Response.Write "  <A HREF=" & QuotedString(strFieldValue) & ">"
  300.                             Response.Write "Go"
  301.                             Response.Write "</A>"
  302.                         End If                    
  303.                 End Select                
  304.             End If
  305.     End Select
  306.        If blnFieldRequired And strFormMode = "New" Then
  307.         Response.Write "  Required"
  308.     End If
  309.     Response.Write "</FONT></TD></TR>"
  310. End Sub    
  311. </SCRIPT>
  312.  
  313. <% 
  314. strFormMode = "Edit"    ' Initalize the default
  315. If Not IsEmpty(Request("FormMode")) Then strFormMode = Request("FormMode")
  316. If Not IsEmpty(Request("rsclassClasses_PagingMove")) Then
  317.     strPagingMove = Trim(Request("rsclassClasses_PagingMove"))
  318. End If
  319. %>
  320.  
  321. <HTML>
  322. <HEAD>
  323.     <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev">
  324.     <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
  325.     <META NAME="Keywords" CONTENT="Microsoft Data Form, Class List Form">
  326.     <TITLE>Class List Form</TITLE>
  327. </HEAD>
  328.  
  329. <!--------------------------- Formatting Section ------------------------------>
  330.  
  331. <BASEFONT FACE="Arial, Helvetica, sans-serif">
  332. <LINK REL=STYLESHEET HREF="./Stylesheets/Grid/Style2.css">
  333. <BODY BACKGROUND="./Images/Grid/Background/Back2.jpg" BGCOLOR=White>
  334.  
  335. <!---------------------------- Lookups Section -------------------------------->
  336.  
  337. <!---------------------------- Heading Section -------------------------------->
  338.  
  339. <% Response.Write "<FORM ACTION=""classAction.asp"" METHOD=""POST"">" %>
  340. <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
  341.     <TR>
  342.         <TH NOWRAP BGCOLOR=Silver BACKGROUND="./Images/Grid/Navigation/Nav1.jpg">
  343.             <FONT SIZE=6> Class List </FONT>
  344.         </TH>
  345.         <TD ALIGN=Right BGCOLOR=Silver VALIGN=MIDDLE WIDTH=100% BACKGROUND="./Images/Grid/Navigation/Nav1.jpg">
  346.             <% 
  347.             If strFormMode = "Form View" then strFormMode = "Edit"
  348.             Select Case strFormMode
  349.                 Case "Edit"    
  350.                     %>
  351.                     <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE="Filter">
  352.                     <% If Session("rsclassClasses_Filter") <> "" Then %>
  353.                           <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE="All Records">
  354.                     <% End If %> 
  355.                 <% Case "Filter" %>
  356.                     <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE=" Apply ">
  357.                     <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE=" Cancel "> 
  358.                 <% Case "New" %>
  359.                     <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE=" Insert ">
  360.                     <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE=" Cancel "> 
  361.             <% End Select %>
  362.              <INPUT TYPE="SUBMIT" NAME="DataAction" VALUE="List View">         
  363.         </TD>
  364.     </TR>
  365.     <TR>
  366.         <TD BGCOLOR=#FFFFCC COLSPAN=3>
  367.             <FONT SIZE=-1>  
  368.             <%
  369.             If Not IsEmpty(Session("rsclassClasses_Status")) And Session("rsclassClasses_Status") <>"" Then
  370.                 Response.Write Session("rsclassClasses_Status")
  371.                 Session("rsclassClasses_Status") = ""
  372.             Else
  373.                 Select Case strFormMode
  374.                     Case "Edit"
  375.                         If IsEmpty(Session("rsclassClasses_Filter")) Then
  376.                             Response.Write "Current Filter: None"
  377.                         Else
  378.                             If Session("rsclassClasses_Filter") <> "" Then
  379.                                 Response.Write "Current Filter: " & Session("rsclassClasses_FilterDisplay")
  380.                             Else
  381.                                 Response.Write "Current Filter: None"
  382.                             End If
  383.                         End If
  384.                     Case "Filter"
  385.                         Response.Write "Status: Ready for filter criteria"
  386.                     Case "New"
  387.                         Response.Write "Status: Ready for new record"
  388.                 End Select
  389.             End If 
  390.             %>
  391.             </FONT>
  392.         </TD>
  393.     </TR></TABLE>
  394.  
  395. <!----------------------------- Form Section ---------------------------------->
  396.  
  397. <!--METADATA TYPE="DesignerControl" startspan
  398.     <OBJECT ID="rsclassClasses" WIDTH=151 HEIGHT=24
  399.         CLASSID="CLSID:F602E721-A281-11CF-A5B7-0080C73AAC7E">
  400.         <PARAM NAME="BarAlignment" VALUE="0">
  401.            <PARAM NAME="PageSize" VALUE="1">
  402.         <PARAM Name="RangeType" Value="1">
  403.         <PARAM Name="DataConnection" Value="StateU">
  404.         <PARAM Name="CommandType" Value="0">
  405.         <PARAM Name="CommandText" Value="SELECT "ClassID", "Title", "MajorID", "Seats", "StartDate" FROM dbo."Classes"">
  406.         <PARAM Name="CursorType" Value="1">
  407.         <PARAM Name="LockType" Value="3">
  408.         <PARAM Name="CacheRecordset" Value="1">
  409.     </OBJECT>
  410. -->
  411.  
  412. <%
  413. fHideNavBar = False
  414. fHideNumber = False
  415. fHideRequery = False
  416. fHideRule = False
  417. stQueryString = ""
  418. fEmptyRecordset = False
  419. fFirstPass = True
  420. fNeedRecordset = False
  421. fNoRecordset = False
  422. tBarAlignment = "Left"
  423. tHeaderName = "rsclassClasses"
  424. tPageSize = 1
  425. tPagingMove = ""
  426. tRangeType = "Form"
  427. tRecordsProcessed = 0
  428. tPrevAbsolutePage = 0
  429. intCurPos = 0
  430. intNewPos = 0
  431. fSupportsBookmarks = True
  432. fMoveAbsolute = False
  433.  
  434. If Not IsEmpty(Request("rsclassClasses_PagingMove")) Then
  435.     tPagingMove = Trim(Request("rsclassClasses_PagingMove"))
  436. End If
  437.  
  438. If IsEmpty(Session("rsclassClasses_Recordset")) Then
  439.     fNeedRecordset = True
  440. Else
  441.     If Session("rsclassClasses_Recordset") Is Nothing Then
  442.         fNeedRecordset = True
  443.     Else
  444.         Set rsclassClasses = Session("rsclassClasses_Recordset")
  445.     End If
  446. End If
  447.  
  448. If fNeedRecordset Then
  449.     Set StateU = Server.CreateObject("ADODB.Connection")
  450.     StateU.ConnectionTimeout = Session("StateU_ConnectionTimeout")
  451.     StateU.CommandTimeout = Session("StateU_CommandTimeout")
  452.     StateU.Open Session("StateU_ConnectionString"), Session("StateU_RuntimeUserName"), Session("StateU_RuntimePassword")
  453.     Set cmdTemp = Server.CreateObject("ADODB.Command")
  454.     Set rsclassClasses = Server.CreateObject("ADODB.Recordset")
  455.     cmdTemp.CommandText = "SELECT ""ClassID"", ""Title"", ""MajorID"", ""Seats"", ""StartDate"" FROM dbo.""Classes"""
  456.     cmdTemp.CommandType = 1
  457.     Set cmdTemp.ActiveConnection = StateU
  458.     rsclassClasses.Open cmdTemp, , 1, 3
  459. End If
  460. On Error Resume Next
  461. If rsclassClasses.BOF And rsclassClasses.EOF Then fEmptyRecordset = True
  462. On Error Goto 0
  463. If Err Then fEmptyRecordset = True
  464. If fNeedRecordset Then
  465.     Set Session("rsclassClasses_Recordset") = rsclassClasses
  466. End If
  467. rsclassClasses.PageSize = tPageSize
  468. fSupportsBookmarks = rsclassClasses.Supports(8192)
  469.  
  470. If Not IsEmpty(Session("rsclassClasses_Filter")) And Not fEmptyRecordset Then
  471.     rsclassClasses.Filter = Session("rsclassClasses_Filter")
  472.     If rsclassClasses.BOF And rsclassClasses.EOF Then fEmptyRecordset = True
  473. End If
  474.  
  475. If IsEmpty(Session("rsclassClasses_PageSize")) Then Session("rsclassClasses_PageSize") = tPageSize
  476. If IsEmpty(Session("rsclassClasses_AbsolutePage")) Then Session("rsclassClasses_AbsolutePage") = 1
  477.  
  478. If Session("rsclassClasses_PageSize") <> tPageSize Then
  479.     tCurRec = ((Session("rsclassClasses_AbsolutePage") - 1) * Session("rsclassClasses_PageSize")) + 1
  480.     tNewPage = Int(tCurRec / tPageSize)
  481.     If tCurRec Mod tPageSize <> 0 Then
  482.         tNewPage = tNewPage + 1
  483.     End If
  484.     If tNewPage = 0 Then tNewPage = 1
  485.     Session("rsclassClasses_PageSize") = tPageSize
  486.     Session("rsclassClasses_AbsolutePage") = tNewPage
  487. End If
  488.  
  489. If fEmptyRecordset Then
  490.     fHideNavBar = True
  491.     fHideRule = True
  492. Else
  493.     tPrevAbsolutePage = Session("rsclassClasses_AbsolutePage")
  494.     Select Case tPagingMove
  495.         Case ""
  496.             fMoveAbsolute = True
  497.         Case "Requery"
  498.             rsclassClasses.Requery
  499.             fMoveAbsolute = True
  500.         Case "<<"
  501.             Session("rsclassClasses_AbsolutePage") = 1
  502.         Case "<"
  503.             If Session("rsclassClasses_AbsolutePage") > 1 Then
  504.                 Session("rsclassClasses_AbsolutePage") = Session("rsclassClasses_AbsolutePage") - 1
  505.             End If
  506.         Case ">"
  507.             If Not rsclassClasses.EOF Then
  508.                 Session("rsclassClasses_AbsolutePage") = Session("rsclassClasses_AbsolutePage") + 1
  509.             End If
  510.         Case ">>"
  511.             If fSupportsBookmarks Then
  512.                 Session("rsclassClasses_AbsolutePage") = rsclassClasses.PageCount
  513.             End If
  514.     End Select
  515.     Do
  516.         If fSupportsBookmarks Then
  517.             rsclassClasses.AbsolutePage = Session("rsclassClasses_AbsolutePage")
  518.         Else
  519.             If fNeedRecordset Or fMoveAbsolute Or rsclassClasses.EOF Then
  520.                 rsclassClasses.MoveFirst
  521.                 rsclassClasses.Move (Session("rsclassClasses_AbsolutePage") - 1) * tPageSize
  522.             Else
  523.                 intCurPos = ((tPrevAbsolutePage - 1) * tPageSize) + tPageSize
  524.                 intNewPos = ((Session("rsclassClasses_AbsolutePage") - 1) * tPageSize) + 1
  525.                 rsclassClasses.Move intNewPos - intCurPos
  526.             End If
  527.             If rsclassClasses.BOF Then rsclassClasses.MoveNext
  528.         End If
  529.         If Not rsclassClasses.EOF Then Exit Do
  530.         Session("rsclassClasses_AbsolutePage") = Session("rsclassClasses_AbsolutePage") - 1
  531.     Loop
  532. End If
  533.  
  534. Do
  535.     If fEmptyRecordset Then Exit Do
  536.     If tRecordsProcessed = tPageSize Then Exit Do
  537.     If Not fFirstPass Then
  538.         rsclassClasses.MoveNext
  539.     Else
  540.         fFirstPass = False
  541.     End If
  542.     If rsclassClasses.EOF Then Exit Do
  543.     tRecordsProcessed = tRecordsProcessed + 1
  544. %>
  545. <!--METADATA TYPE="DesignerControl" endspan-->
  546.  
  547. <% 
  548. If strFormMode = "Edit" Then
  549.     Response.Write "<P>"
  550.     Response.Write "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0>"
  551.     ShowField "ClassID", "ClassID", False, Null
  552.     ShowField "Title", "Title", False, Null
  553.     ShowField "MajorID", "MajorID", False, Null
  554.     ShowField "Seats", "Seats", False, Null
  555.     ShowField "StartDate", "StartDate", False, Null
  556.     Response.Write "</TABLE>"
  557.     Response.Write "</FORM></P>"
  558.     stQueryString = "?FormMode=Edit"
  559.     fHideNavBar = False
  560.     fHideRule = True
  561. Else
  562.     fHideNavBar = True
  563.     fHideRule = True
  564. End If 
  565. %>
  566.  
  567. <!--METADATA TYPE="DesignerControl" startspan
  568.     <OBJECT ID="DataRangeFtr1" WIDTH=151 HEIGHT=24
  569.         CLASSID="CLSID:F602E722-A281-11CF-A5B7-0080C73AAC7E">
  570.     </OBJECT>
  571. -->
  572. <%
  573. Loop
  574. If tRangeType = "Table" Then Response.Write "</TABLE>"
  575. If tPageSize > 0 Then
  576.     If Not fHideRule Then Response.Write "<HR>"
  577.     If Not fHideNavBar Then
  578.         %>
  579.         <TABLE WIDTH=100% >
  580.         <TR>
  581.             <TD WIDTH=100% >
  582.                 <P ALIGN=<%= tBarAlignment %> >
  583.                 <FORM <%= "ACTION=""" & Request.ServerVariables("PATH_INFO") & stQueryString & """" %> METHOD="POST">
  584.                     <INPUT TYPE="Submit" NAME="<%= tHeaderName & "_PagingMove" %>" VALUE="   <<   ">
  585.                     <INPUT TYPE="Submit" NAME="<%= tHeaderName & "_PagingMove" %>" VALUE="   <    ">
  586.                     <INPUT TYPE="Submit" NAME="<%= tHeaderName & "_PagingMove" %>" VALUE="    >   ">
  587.                     <% If fSupportsBookmarks Then %>
  588.                         <INPUT TYPE="Submit" NAME="<%= tHeaderName & "_PagingMove" %>" VALUE="   >>   ">
  589.                     <% End If %>
  590.                     <% If Not fHideRequery Then %>
  591.                         <INPUT TYPE="Submit" NAME="<% =tHeaderName & "_PagingMove" %>" VALUE=" Requery ">
  592.                     <% End If %>
  593.                 </FORM>
  594.                 </P>
  595.             </TD>
  596.             <TD VALIGN=MIDDLE ALIGN=RIGHT>
  597.                 <FONT SIZE=2>
  598.                 <%
  599.                 If Not fHideNumber Then
  600.                     If tPageSize > 1 Then
  601.                         Response.Write "<NOBR>Page: " & Session(tHeaderName & "_AbsolutePage") & "</NOBR>"
  602.                     Else
  603.                         Response.Write "<NOBR>Record: " & Session(tHeaderName & "_AbsolutePage") & "</NOBR>"
  604.                     End If
  605.                 End If
  606.                 %>
  607.                 </FONT>
  608.             </TD>
  609.         </TR>
  610.         </TABLE>
  611.     <%
  612.     End If
  613. End If
  614. %>
  615. <!--METADATA TYPE="DesignerControl" endspan-->
  616.  
  617. <% 
  618. If strFormMode <> "Edit" Then
  619.     Response.Write "<P>"
  620.     Response.Write "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0>"
  621.     ShowField "ClassID", "ClassID", False, Null
  622.     ShowField "Title", "Title", False, Null
  623.     ShowField "MajorID", "MajorID", False, Null
  624.     ShowField "Seats", "Seats", False, Null
  625.     ShowField "StartDate", "StartDate", False, Null
  626.     Response.Write "</TABLE>"
  627.     Response.Write "</FORM></P>"    
  628. End If
  629. %>
  630.  
  631. <!---------------------------- Footer Section --------------------------------->
  632.  
  633. <%
  634. ' Display a message if there are no records to show
  635. If strFormMode = "Edit" And fEmptyRecordset Then
  636.     Response.Write "<p align=left>No Records Available</p>"
  637. End If
  638. ' TEMP: This is here until we get a drop of the data range that has
  639. '         the CacheRecordset property  
  640. If fNeedRecordset Then
  641.     Set Session("rsclassClasses_Recordset") = rsclassClasses
  642. End If
  643. %>
  644.  
  645. </BODY>
  646. </HTML>
  647.  
  648.